package com.ncmmall.domain.business.live;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ncmmall.domain.business.goods.Goods;
import com.ncmmall.domain.security.user.WebUser;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * 直播商品池
 */
@Entity
@Table(name = "live_goods")
@Access(AccessType.FIELD)
@Getter
@Setter
@Accessors(chain = true)
public class LiveGoods {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    /**
     * 商家
     */
    @OneToOne
    @JoinColumn(name = "merchant_id")
    private WebUser merchant;

    /**
     * 商品
     */
    @OneToOne
    @JoinColumn(name = "goods_id")
    private Goods goods;

    /**
     * 代播范围
     * 1、全体直播间
     * 2、指定直播间
     */
    @Column(name = "live_scope")
    private int liveScope;

    /**
     * 代播佣金比例
     */
    @Column(name = "guarantee_scale")
    private double guaranteeScale;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Timestamp createTime;

    /**
     * 1、已上架
     * 2、已下架
     * 3、已删除
     */
    private int status;

    /**
     * 推广排序值
     */
    private int rank;

    @Transient
    @JsonIgnore
    private Double minPrice;

    @Transient
    @JsonIgnore
    private Double maxPrice;

    @Transient
    @JsonIgnore
    private Integer minScale;

    @Transient
    @JsonIgnore
    private Integer maxScale;

    /**
     * 商品id
     */
    @Transient
    @JsonIgnore
    private String goodsIds;

    /**
     * 直播间id
     */
    @Transient
    @JsonIgnore
    private String distributorIds;

    /**
     * 主播数量
     */
    @Transient
    private int anchorNumber;

}
